this.name			= "bweed-kestrelfalcon-falcon";
this.author			= "Kaks";
this.copyright		= "Creative Commons: attribution, non-commercial, sharealike.";
this.description	= "Ship's internal systems";
this.version		= "0.9.1";

this.subpleas = {'bweed-falcon-airlock-l':'[bweed-airlock-plea]','bweed-falcon-airlock-r':'[bweed-airlock-plea]','bweed-falcon-gun':'[bweed-guns-plea]','bweed-falcon-dish':'[bweed-dish-plea]','bweed-falcon-vents':'[bweed-vents-plea]','bweed-falcon-scoop':'[bweed-scoop-plea]','bweed-falcon-turret':'[bweed-guns-plea]'}

this.shipSpawned = this.shipWillLaunchFromStation = function()
{
	let e=this.ship.subEntities;
	e.items= function()
	{
		for (let i = 0; i < this.length; i++) yield this[i];
	}
	for (let i in e.items())
	{
		i.script.plea= this.subpleas[i.primaryRole];
		i.script.owner=this.ship; //1.70 workaround
		i.script.shipDied = function()
		{
			//all instances of 'this' inside this function refer to the subentity script
			//this.owner.call('commsMessage:',this.plea);
			player.commsMessage(expandDescription(this.plea), 5);
		}
	}
}

this.shipDied = function()
{
/*	this.ship.call('commsMessage:', '[bweed-kestrel-plea]');
	this.ship.call('spawn:', 'explosive_shrapnel 4');*/
	this.ship.commsMessage('[bweed-falcon-plea]', 5);
	this.ship.spawn('explosive_shrapnel 6');
}